using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum PoolType
{
    Thrown
}
public class PoolManager : MonoSingleton<PoolManager>
{
    public Dictionary<PoolType, Pool> poolDic;
    private void Start()
    {
        poolDic = new Dictionary<PoolType, Pool>();
        foreach (Pool pool in GetComponentsInChildren<Pool>(true))
        {
            if (pool.PoolType != null)
            {
                poolDic[pool.PoolType] = pool;
            }
            else
            {
                Debug.LogWarning($"Found a Pool component without a valid PoolType: {pool}");
            }
        }
    }
    public GameObject Obtain(PoolType poolType)
    {
        return poolDic[poolType].Obtain();

    }
    public void Free(PoolType poolType, GameObject freeObject)
    {
        poolDic[poolType].Free(freeObject);
    }
}
